﻿using System;
using Resources;
using Yglu.BusinessLayer;
using Yglu.BusinessLayer.Reports;

namespace Yglu.WebAdmin
{
	public class ReportManager
	{
		#region Main reports

		public static StoreOrdersCollection GetStoreOrders(Int32 storeId)
		{
			StoreOrdersCollection reports = new StoreOrdersCollection();

			reports.Add(new StoreOrders(DataAccess.Report_StoreOrders(storeId, Period.Today())));
			reports.Add(new StoreOrders(DataAccess.Report_StoreOrders(storeId, Period.Yesterday())));
			reports.Add(new StoreOrders(DataAccess.Report_StoreOrders(storeId, Period.Last7Days())));
			reports.Add(new StoreOrders(DataAccess.Report_StoreOrders(storeId, Period.Last30Days())));
			reports.Add(new StoreOrders(DataAccess.Report_StoreOrders(storeId, null)));

			reports[0].Title = Messages.Today;
			reports[1].Title = Messages.Yesterday;
			reports[2].Title = Messages.Last7Days;
			reports[3].Title = Messages.Last30Days;
			reports[4].Title = Messages.Total;

			return reports;
		}

		public static UserOrdersCollection GetUserOrders(Int32 userId)
		{
			UserOrdersCollection reports = new UserOrdersCollection();

			reports.Add(new UserOrders(DataAccess.Report_UserOrders(userId, SessionManager.LoggedStore, Period.Today())));
			reports.Add(new UserOrders(DataAccess.Report_UserOrders(userId, SessionManager.LoggedStore, Period.Yesterday())));
			reports.Add(new UserOrders(DataAccess.Report_UserOrders(userId, SessionManager.LoggedStore, Period.Last7Days())));
			reports.Add(new UserOrders(DataAccess.Report_UserOrders(userId, SessionManager.LoggedStore, Period.Last30Days())));
			reports.Add(new UserOrders(DataAccess.Report_UserOrders(userId, SessionManager.LoggedStore, null)));

			reports[0].Title = Messages.Today;
			reports[1].Title = Messages.Yesterday;
			reports[2].Title = Messages.Last7Days;
			reports[3].Title = Messages.Last30Days;
			reports[4].Title = Messages.Total;

			return reports;
		}

		public static ProductOrdersCollection GetProductOrders(Int32 productId)
		{
			ProductOrdersCollection reports = new ProductOrdersCollection();

			reports.Add(new ProductOrders(DataAccess.Report_ProductOrders(productId, SessionManager.LoggedStore, Period.Today())));
			reports.Add(new ProductOrders(DataAccess.Report_ProductOrders(productId, SessionManager.LoggedStore, Period.Yesterday())));
			reports.Add(new ProductOrders(DataAccess.Report_ProductOrders(productId, SessionManager.LoggedStore, Period.Last7Days())));
			reports.Add(new ProductOrders(DataAccess.Report_ProductOrders(productId, SessionManager.LoggedStore, Period.Last30Days())));
			reports.Add(new ProductOrders(DataAccess.Report_ProductOrders(productId, SessionManager.LoggedStore, null)));

			reports[0].Title = Messages.Today;
			reports[1].Title = Messages.Yesterday;
			reports[2].Title = Messages.Last7Days;
			reports[3].Title = Messages.Last30Days;
			reports[4].Title = Messages.Total;

			return reports;
		}

		public static PromotionUsageCollection GetPromotionUsage(Int32 promotionId)
		{
			PromotionUsageCollection reports = new PromotionUsageCollection();

			reports.Add(new PromotionUsage(DataAccess.Report_PromotionUsage(promotionId, SessionManager.LoggedStore, Period.Today())));
			reports.Add(new PromotionUsage(DataAccess.Report_PromotionUsage(promotionId, SessionManager.LoggedStore, Period.Yesterday())));
			reports.Add(new PromotionUsage(DataAccess.Report_PromotionUsage(promotionId, SessionManager.LoggedStore, Period.Last7Days())));
			reports.Add(new PromotionUsage(DataAccess.Report_PromotionUsage(promotionId, SessionManager.LoggedStore, Period.Last30Days())));
			reports.Add(new PromotionUsage(DataAccess.Report_PromotionUsage(promotionId, SessionManager.LoggedStore, null)));

			reports[0].Title = Messages.Today;
			reports[1].Title = Messages.Yesterday;
			reports[2].Title = Messages.Last7Days;
			reports[3].Title = Messages.Last30Days;
			reports[4].Title = Messages.Total;

			return reports;
		}

		#endregion
	}
}